cc_library(
    name = "glew_static",
    srcs = ["src/glew.c"],
    hdrs = [
        "include/GL/eglew.h",
        "include/GL/glew.h",
        "include/GL/glxew.h",
        "include/GL/wglew.h",
    ],
    defines = ["GLEW_STATIC"],
    strip_include_prefix = "include",
    visibility = ["//visibility:public"],
    alwayslink = False,
)

cc_binary(
    name = "glewinfo",
    srcs = ["src/glewinfo.c"],
    linkopts = select({
        "@platforms//os:windows": [
            "-DEFAULTLIB:opengl32.lib",
            "-DEFAULTLIB:User32.lib",
            "-DEFAULTLIB:Gdi32.lib",
        ],
        "@platforms//os:macos": [
            "-Wl,-framework,OpenGL",
        ],
        "//conditions:default": [
            "-lGL",
            "-lX11",
        ],
    }),
    visibility = ["//visibility:public"],
    deps = [":glew_static"],
)
